package presentacion;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;

import java.awt.BorderLayout;

import javax.swing.DefaultListModel;
import javax.swing.JMenuItem;

import java.awt.Font;

import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.JList;
import javax.swing.JSeparator;
import javax.swing.JLabel;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.ComponentOrientation;
import java.awt.Cursor;
import java.awt.Toolkit;
import java.awt.Color;

import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JScrollPane;
import javax.swing.border.MatteBorder;

import java.awt.Component;

import dominio.ListenerCerrarVentana;
import dominio.OtroListCellRenderer;
import dominio.Util;

import javax.swing.ListSelectionModel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ButtonGroup;

public class Menu {

	JFrame VentanaPrincipal;
	private JPanel pnlGeneral;
	private JButton btnAyuda;
	private JButton btnSalir;
	public static JPanel pnlBienvenida;
	private JButton btnParticipantes;
	private JButton btnCompeticiones;
	private JLabel lblFondo;
	private JLabel lblBienvenida;
	private JLabel lblHacer;
	JLabel lblNombre;
	private JMenuBar menuBar;
	private JMenu mnArchivo;
	private JMenu mnGestion;
	private JMenu mnAyuda;
	private JMenuItem mntmAcercaDe;
	private JMenuItem mntmAyuda;
	private JMenu mnParticipantes;
	private JMenu mnCompeticiones;
	private JMenuItem mntmSalir;
	private JSeparator separator;
	private JMenu mnCambiarIdioma;
	private JRadioButtonMenuItem mntmEspaol;
	private JRadioButtonMenuItem mntmIngls;
	private JLabel lblltimaConexion;
	private JLabel lblIdentificadoComo;
	JLabel lblUserIdent;
	JLabel lblHora;
	private JSeparator separator_1;
	public static JPanel pnlParticipantes;
	private JScrollPane scrollPane;
	private JList<?> lstParticipantes;
	private JButton btnAniadir;
	private JButton btnModificar;
	private JButton btnEliminar;
	private JButton btnConsultar;
	private JButton btnAtras;
	private JLabel lblParticipantes;
	public static JPanel pnlCompeticiones;
	private JLabel lblCompeticiones;
	private JButton btnAtra;
	private JButton btn10000m;
	private JButton btnCarreraPopular;
	private JLabel lbl10000m;
	private JLabel lblCarreraPopular;
	private JButton btnCross;
	private JLabel lblCross;
	private JButton btnDuatlon;
	private JButton btnMaraton;
	private JButton btnMMaraton;
	private JButton btnMontana;
	private JButton btnSSilvestre;
	private JButton btnTriatlon;
	private JLabel lblDuatlon;
	private JLabel lblMaraton;
	private JLabel lblMMaraton;
	private JLabel lblMontana;
	private JLabel lblSanSilvestre;
	private JLabel lblTriatln;
	private final ButtonGroup buttonGroup = new ButtonGroup();
	private JMenuItem mntmAadir;
	private JMenuItem mntmm;
	private JMenuItem mntmCarreraPopular;
	private JMenuItem mntmCross;
	private JMenuItem mntmDuatln;
	private JMenuItem mntmMaratn;
	private JMenuItem mntmMediaMaratn;
	private JMenuItem mntmMontaa;
	private JMenuItem mntmSanSilvestre;
	private JMenuItem mntmTriatln;
	private JMenuItem mntmAtrs;
	private JMenuItem mntmListaDeParticipantes;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Menu window = new Menu();
					window.VentanaPrincipal.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Menu() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	@SuppressWarnings("deprecation")
	private void initialize() {
		VentanaPrincipal = new JFrame();
		VentanaPrincipal.addWindowListener(new ListenerCerrarVentana(
				VentanaPrincipal));
		VentanaPrincipal.setResizable(false);
		VentanaPrincipal.setIconImage(Toolkit.getDefaultToolkit().getImage(
				Menu.class.getResource("/recursos/LOGO.png"))); //$NON-NLS-1$
		VentanaPrincipal.setVisible(true);
		VentanaPrincipal.setTitle("Run +"); //$NON-NLS-1$
		VentanaPrincipal.setBounds(100, 100, 1191, 754);
		VentanaPrincipal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		VentanaPrincipal.setLocationRelativeTo(null);
		{
			pnlGeneral = new JPanel();
			VentanaPrincipal.getContentPane().add(pnlGeneral,
					BorderLayout.CENTER);
			pnlGeneral.setLayout(null);
			{
				btnAyuda = new JButton(""); //$NON-NLS-1$
				btnAyuda.setMnemonic('H');
				btnAyuda.addActionListener(new AyudaActionListener());
				btnAyuda.setCursor(Cursor
						.getPredefinedCursor(Cursor.HAND_CURSOR));
				btnAyuda.setToolTipText(Messages.getString("Menu.3")); //$NON-NLS-1$
				btnAyuda.setIcon(new ImageIcon(Menu.class
						.getResource("/recursos/help.png"))); //$NON-NLS-1$
				btnAyuda.setBounds(1146, 0, 27, 25);
				pnlGeneral.add(btnAyuda);
			}
			{
				btnSalir = new JButton(Messages.getString("Menu.5")); //$NON-NLS-1$
				btnSalir.setMnemonic('E');
				btnSalir.setToolTipText(Messages.getString("Menu.6")); //$NON-NLS-1$
				btnSalir.setCursor(Cursor
						.getPredefinedCursor(Cursor.HAND_CURSOR));
				btnSalir.addActionListener(new SalirActionListener());
				btnSalir.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
				btnSalir.setBounds(1046, 633, 109, 34);
				pnlGeneral.add(btnSalir);
				btnSalir.setIcon(new ImageIcon(Menu.class
						.getResource("/recursos/login_out_32.png"))); //$NON-NLS-1$
			}
			{
				pnlCompeticiones = new JPanel();
				pnlCompeticiones.setOpaque(false);
				pnlCompeticiones.setBounds(0, 69, 1186, 563);
				pnlGeneral.add(pnlCompeticiones);
				pnlCompeticiones.setLayout(null);
				pnlCompeticiones.setVisible(false);
				pnlCompeticiones.enable(false);
				{
					lblCompeticiones = new JLabel(Messages.getString("Menu.9")); //$NON-NLS-1$
					lblCompeticiones.setBounds(511, 0, 259, 43);
					lblCompeticiones.setFont(new Font("Tahoma", Font.BOLD, 35)); //$NON-NLS-1$
					pnlCompeticiones.add(lblCompeticiones);
				}
				{
					btnAtra = new JButton(Messages.getString("Menu.0")); //$NON-NLS-1$
					btnAtra.setMnemonic('B');
					btnAtra.setToolTipText(Messages.getString("Menu.12")); //$NON-NLS-1$
					btnAtra.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnAtra.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/Back.png"))); //$NON-NLS-1$
					btnAtra.addActionListener(new AtrasActionListener());
					btnAtra.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnAtra.setBounds(994, 505, 141, 32);
					pnlCompeticiones.add(btnAtra);
				}
				{
					btn10000m = new JButton(""); //$NON-NLS-1$
					btn10000m.setToolTipText(Messages.getString("Menu.16")); //$NON-NLS-1$
					btn10000m.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btn10000m.addActionListener(new SelectComp("10000m")); //$NON-NLS-1$
					btn10000m.setBackground(Color.WHITE);
					btn10000m.setHorizontalTextPosition(SwingConstants.CENTER);
					btn10000m.setVerticalTextPosition(SwingConstants.BOTTOM);
					btn10000m.setAlignmentX(Component.CENTER_ALIGNMENT);
					btn10000m.setActionCommand("1000m"); //$NON-NLS-1$
					btn10000m.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/10000m64.png"))); //$NON-NLS-1$
					btn10000m.setBounds(464, 103, 57, 60);
					pnlCompeticiones.add(btn10000m);
				}
				{
					btnCarreraPopular = new JButton(""); //$NON-NLS-1$
					btnCarreraPopular
							.setToolTipText(Messages.getString("Menu.21")); //$NON-NLS-1$
					btnCarreraPopular.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnCarreraPopular.addActionListener(new SelectComp(
							"CarreraPopular")); //$NON-NLS-1$
					btnCarreraPopular
							.setVerticalTextPosition(SwingConstants.BOTTOM);
					btnCarreraPopular
							.setHorizontalTextPosition(SwingConstants.CENTER);
					btnCarreraPopular.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/CarreraPopular64.png"))); //$NON-NLS-1$
					btnCarreraPopular.setBounds(606, 103, 57, 60);
					pnlCompeticiones.add(btnCarreraPopular);
				}
				{
					lbl10000m = new JLabel("10.000m"); //$NON-NLS-1$
					lbl10000m.setFont(new Font("Arial Black", Font.BOLD, 13)); //$NON-NLS-1$
					lbl10000m.setHorizontalAlignment(SwingConstants.CENTER);
					lbl10000m.setBounds(450, 163, 81, 16);
					pnlCompeticiones.add(lbl10000m);
				}
				{
					lblCarreraPopular = new JLabel(Messages.getString("Menu.1")); //$NON-NLS-1$
					lblCarreraPopular
							.setHorizontalAlignment(SwingConstants.CENTER);
					lblCarreraPopular
							.setHorizontalTextPosition(SwingConstants.CENTER);
					lblCarreraPopular
							.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblCarreraPopular.setBounds(576, 163, 112, 16);
					pnlCompeticiones.add(lblCarreraPopular);
				}
				{
					btnCross = new JButton(""); //$NON-NLS-1$
					btnCross.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/cross64x64.png"))); //$NON-NLS-1$
					btnCross.setToolTipText(Messages.getString("Menu.30")); //$NON-NLS-1$
					btnCross.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnCross.addActionListener(new SelectComp("Cross")); //$NON-NLS-1$
					btnCross.setBounds(760, 103, 57, 60);
					pnlCompeticiones.add(btnCross);
				}
				{
					lblCross = new JLabel(Messages.getString("Menu.32")); //$NON-NLS-1$
					lblCross.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblCross.setHorizontalTextPosition(SwingConstants.CENTER);
					lblCross.setHorizontalAlignment(SwingConstants.CENTER);
					lblCross.setBounds(761, 163, 56, 16);
					pnlCompeticiones.add(lblCross);
				}
				{
					btnDuatlon = new JButton(""); //$NON-NLS-1$
					btnDuatlon.setToolTipText(Messages.getString("Menu.2")); //$NON-NLS-1$
					btnDuatlon.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnDuatlon.addActionListener(new SelectComp("Duatlon")); //$NON-NLS-1$
					btnDuatlon.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/Duatlon64.png"))); //$NON-NLS-1$
					btnDuatlon.setBounds(464, 218, 57, 60);
					pnlCompeticiones.add(btnDuatlon);
				}
				{
					btnMaraton = new JButton(""); //$NON-NLS-1$
					btnMaraton.setToolTipText("Competiciones : Maratón"); //$NON-NLS-1$
					btnMaraton.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnMaraton.addActionListener(new SelectComp("Maraton")); //$NON-NLS-1$
					btnMaraton.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/Maraton64.png"))); //$NON-NLS-1$
					btnMaraton.setBounds(606, 218, 57, 60);
					pnlCompeticiones.add(btnMaraton);
				}
				{
					btnMontana = new JButton(""); //$NON-NLS-1$
					btnMontana.setToolTipText(Messages.getString("Menu.43")); //$NON-NLS-1$
					btnMontana.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnMontana.addActionListener(new SelectComp("Montana")); //$NON-NLS-1$
					{
						btnMMaraton = new JButton(""); //$NON-NLS-1$
						btnMMaraton
								.setToolTipText(Messages.getString("Menu.46")); //$NON-NLS-1$
						btnMMaraton.setCursor(Cursor
								.getPredefinedCursor(Cursor.HAND_CURSOR));
						btnMMaraton.addActionListener(new SelectComp(
								"MediaMaraton")); //$NON-NLS-1$
						btnMMaraton.setIcon(new ImageIcon(Menu.class
								.getResource("/recursos/MediaMaraton64.png"))); //$NON-NLS-1$
						btnMMaraton.setBounds(760, 218, 57, 60);
						pnlCompeticiones.add(btnMMaraton);
					}
					btnMontana.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/Montaña64.png"))); //$NON-NLS-1$
					btnMontana.setBounds(464, 350, 57, 60);
					pnlCompeticiones.add(btnMontana);
				}
				{
					btnSSilvestre = new JButton(""); //$NON-NLS-1$
					btnSSilvestre
							.setToolTipText(Messages.getString("Menu.51")); //$NON-NLS-1$
					btnSSilvestre.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnSSilvestre
							.addActionListener(new SelectComp("SSilvestre")); //$NON-NLS-1$
					btnSSilvestre.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/SanSilvestre64.png"))); //$NON-NLS-1$
					btnSSilvestre.setBounds(606, 350, 57, 60);
					pnlCompeticiones.add(btnSSilvestre);
				}
				{
					btnTriatlon = new JButton(""); //$NON-NLS-1$
					btnTriatlon.setToolTipText(Messages.getString("Menu.55")); //$NON-NLS-1$
					btnTriatlon.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnTriatlon.addActionListener(new SelectComp("Triatlon")); //$NON-NLS-1$
					btnTriatlon.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/triatlon60s.png"))); //$NON-NLS-1$
					btnTriatlon.setBounds(760, 350, 57, 60);
					pnlCompeticiones.add(btnTriatlon);
				}
				{
					lblDuatlon = new JLabel(Messages.getString("Menu.58")); //$NON-NLS-1$
					lblDuatlon.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblDuatlon.setHorizontalTextPosition(SwingConstants.CENTER);
					lblDuatlon.setHorizontalAlignment(SwingConstants.CENTER);
					lblDuatlon.setBounds(450, 279, 70, 16);
					pnlCompeticiones.add(lblDuatlon);
				}
				{
					lblMaraton = new JLabel(Messages.getString("Menu.60")); //$NON-NLS-1$
					lblMaraton.setHorizontalTextPosition(SwingConstants.CENTER);
					lblMaraton.setHorizontalAlignment(SwingConstants.CENTER);
					lblMaraton.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblMaraton.setBounds(606, 279, 70, 16);
					pnlCompeticiones.add(lblMaraton);
				}
				{
					lblMMaraton = new JLabel(Messages.getString("Menu.62")); //$NON-NLS-1$
					lblMMaraton
							.setHorizontalTextPosition(SwingConstants.CENTER);
					lblMMaraton.setHorizontalAlignment(SwingConstants.CENTER);
					lblMMaraton.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblMMaraton.setBounds(735, 279, 97, 16);
					pnlCompeticiones.add(lblMMaraton);
				}
				{
					lblMontana = new JLabel(Messages.getString("Menu.64")); //$NON-NLS-1$
					lblMontana.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblMontana.setHorizontalTextPosition(SwingConstants.CENTER);
					lblMontana.setHorizontalAlignment(SwingConstants.CENTER);
					lblMontana.setBounds(432, 408, 112, 16);
					pnlCompeticiones.add(lblMontana);
				}
				{
					lblSanSilvestre = new JLabel(Messages.getString("Menu.66")); //$NON-NLS-1$
					lblSanSilvestre.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblSanSilvestre
							.setHorizontalTextPosition(SwingConstants.CENTER);
					lblSanSilvestre
							.setHorizontalAlignment(SwingConstants.CENTER);
					lblSanSilvestre.setBounds(591, 408, 97, 16);
					pnlCompeticiones.add(lblSanSilvestre);
				}
				{
					lblTriatln = new JLabel(Messages.getString("Menu.68")); //$NON-NLS-1$
					lblTriatln.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
					lblTriatln.setHorizontalTextPosition(SwingConstants.CENTER);
					lblTriatln.setHorizontalAlignment(SwingConstants.CENTER);
					lblTriatln.setBounds(760, 408, 72, 16);
					pnlCompeticiones.add(lblTriatln);
				}
			}
			{
				pnlBienvenida = new JPanel();
				pnlBienvenida.setOpaque(false);
				pnlBienvenida.setLayout(null);
				pnlBienvenida.setBounds(7, 69, 1179, 563);
				pnlGeneral.add(pnlBienvenida);
				{

					btnParticipantes = new JButton(Messages.getString("Menu.70")); //$NON-NLS-1$
					btnParticipantes
							.addActionListener(new AccederParticipantesActionListener());
					btnParticipantes
							.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnParticipantes.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/Oil-icono-comunidad.png"))); //$NON-NLS-1$
					btnParticipantes.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnParticipantes
							.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
					btnParticipantes.setToolTipText(Messages.getString("Menu.73")); //$NON-NLS-1$
					btnParticipantes.setBounds(492, 224, 220, 58);
					pnlBienvenida.add(btnParticipantes);
				}
				{
					btnCompeticiones = new JButton(Messages.getString("Menu.74")); //$NON-NLS-1$
					btnCompeticiones.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent arg0) {
							mntmAtrs.setEnabled(true);
							pnlCompeticiones.enable(true);
							pnlCompeticiones.setVisible(true);
							pnlBienvenida.enable(false);
							pnlBienvenida.setVisible(false);
							btnSalir.setVisible(false);
						}
					});
					btnCompeticiones
							.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnCompeticiones.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/wooden_notepad_64.png"))); //$NON-NLS-1$
					btnCompeticiones.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnCompeticiones.setToolTipText(Messages.getString("Menu.77")); //$NON-NLS-1$
					btnCompeticiones.setBounds(492, 295, 220, 63);
					pnlBienvenida.add(btnCompeticiones);
				}
				{
					lblBienvenida = new JLabel(
							Messages.getString("Menu.78")); //$NON-NLS-1$
					lblBienvenida.setFont(new Font("Nueva Std", Font.BOLD, 70)); //$NON-NLS-1$
					lblBienvenida.setBounds(193, 0, 777, 58);
					pnlBienvenida.add(lblBienvenida);
				}
				{
					lblHacer = new JLabel(
							Messages.getString("Menu.80")); //$NON-NLS-1$
					lblHacer.setBackground(Color.WHITE);
					lblHacer.setFont(new Font("Tahoma", Font.BOLD, 18)); //$NON-NLS-1$
					lblHacer.setBounds(349, 160, 527, 32);
					pnlBienvenida.add(lblHacer);
				}
				{
					lblNombre = new JLabel(""); //$NON-NLS-1$
					lblNombre.setHorizontalAlignment(SwingConstants.CENTER);
					lblNombre.setFont(new Font("Nueva Std", Font.PLAIN, 70)); //$NON-NLS-1$
					lblNombre.setBounds(578, 0, 338, 58);
					pnlBienvenida.add(lblNombre);
				}
			}
			{
				pnlParticipantes = new JPanel();
				pnlParticipantes.setOpaque(false);
				pnlParticipantes.setBounds(0, 69, 1179, 563);
				pnlParticipantes.enable(false);
				pnlParticipantes.setVisible(false);
				pnlGeneral.add(pnlParticipantes);
				pnlParticipantes.setLayout(null);
				{
					scrollPane = new JScrollPane();
					scrollPane.setBorder(new MatteBorder(2, 2, 2, 2,
							(Color) new Color(0, 0, 0)));
					scrollPane.setBounds(191, 81, 461, 436);
					pnlParticipantes.add(scrollPane);
					{
						lstParticipantes = new JList();
						lstParticipantes
								.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
						DefaultListModel modeloLista = new DefaultListModel();
						lstParticipantes.setModel(modeloLista);
						dominio.Util.aniadeListaPersona(modeloLista,
								dominio.Util.generaParticipantes());
						lstParticipantes
								.setCellRenderer(new OtroListCellRenderer(0));
						scrollPane.setViewportView(lstParticipantes);
					}
				}
				{
					btnAniadir = new JButton(Messages.getString("Menu.84")); //$NON-NLS-1$
					btnAniadir.setToolTipText(Messages.getString("Menu.85")); //$NON-NLS-1$
					btnAniadir.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnAniadir.addActionListener(new AniadirActionListener());
					btnAniadir.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnAniadir
							.setIcon(new ImageIcon(
									Menu.class
											.getResource("/recursos/anadir-usuario-icono-7225-32.png"))); //$NON-NLS-1$
					btnAniadir.setBounds(827, 98, 143, 35);
					pnlParticipantes.add(btnAniadir);
				}
				{
					btnModificar = new JButton(Messages.getString("Menu.88")); //$NON-NLS-1$
					btnModificar
							.setToolTipText(Messages.getString("Menu.89")); //$NON-NLS-1$
					btnModificar.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnModificar
							.addActionListener(new ModificarActionListener());
					btnModificar.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnModificar
							.setIcon(new ImageIcon(
									Menu.class
											.getResource("/recursos/vcard-editar-icono-7017-32.png"))); //$NON-NLS-1$
					btnModificar.setBounds(827, 196, 143, 35);
					pnlParticipantes.add(btnModificar);
				}
				{
					btnEliminar = new JButton(Messages.getString("Menu.92")); //$NON-NLS-1$
					btnEliminar
							.setToolTipText(Messages.getString("Menu.93")); //$NON-NLS-1$
					btnEliminar.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnEliminar.addActionListener(new EliminarActionListener());
					btnEliminar.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnEliminar.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/eliminar.png"))); //$NON-NLS-1$
					btnEliminar.setBounds(827, 241, 143, 34);
					pnlParticipantes.add(btnEliminar);
				}
				{
					btnConsultar = new JButton(Messages.getString("Menu.96")); //$NON-NLS-1$
					btnConsultar
							.setToolTipText(Messages.getString("Menu.97")); //$NON-NLS-1$
					btnConsultar.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnConsultar
					.addActionListener(new ConsultarActionListener());
					
					btnConsultar.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnConsultar.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/ojo-icono-9657-32.png"))); //$NON-NLS-1$
					btnConsultar.setBounds(827, 288, 143, 35);
					pnlParticipantes.add(btnConsultar);
				}
				{
					btnAtras = new JButton(Messages.getString("Menu.100")); //$NON-NLS-1$
					btnAtras.setMnemonic('B');
					btnAtras.setToolTipText(Messages.getString("Menu.101")); //$NON-NLS-1$
					btnAtras.setCursor(Cursor
							.getPredefinedCursor(Cursor.HAND_CURSOR));
					btnAtras.addActionListener(new AtrasActionListener());
					btnAtras.setIcon(new ImageIcon(Menu.class
							.getResource("/recursos/Back.png"))); //$NON-NLS-1$
					btnAtras.setFont(new Font("Tahoma", Font.PLAIN, 16)); //$NON-NLS-1$
					btnAtras.setBounds(992, 504, 143, 35);
					pnlParticipantes.add(btnAtras);
				}
				{
					lblParticipantes = new JLabel(Messages.getString("Menu.104")); //$NON-NLS-1$
					lblParticipantes.setFont(new Font("Tahoma", Font.BOLD, 35)); //$NON-NLS-1$
					lblParticipantes.setBounds(447, 13, 246, 38);
					pnlParticipantes.add(lblParticipantes);
				}

			}
			{
				lblltimaConexion = new JLabel(Messages.getString("Menu.106")); //$NON-NLS-1$
				lblltimaConexion.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
				lblltimaConexion.setBounds(937, 27, 116, 16);
				pnlGeneral.add(lblltimaConexion);
			}
			{
				lblIdentificadoComo = new JLabel(Messages.getString("Menu.108")); //$NON-NLS-1$
				lblIdentificadoComo.setFont(new Font("Tahoma", Font.BOLD, 13)); //$NON-NLS-1$
				lblIdentificadoComo.setBounds(990, 41, 148, 16);
				pnlGeneral.add(lblIdentificadoComo);
			}
			{
				lblUserIdent = new JLabel(""); //$NON-NLS-1$
				lblUserIdent.setBounds(1116, 41, 56, 16);
				pnlGeneral.add(lblUserIdent);
			}
			{
				lblHora = new JLabel(""); //$NON-NLS-1$
				lblHora.setBounds(1046, 27, 133, 16);
				pnlGeneral.add(lblHora);

			}
			{
				menuBar = new JMenuBar();
				VentanaPrincipal.setJMenuBar(menuBar);
				{
					mnArchivo = new JMenu(Messages.getString("Menu.112")); //$NON-NLS-1$
					mnArchivo.setMnemonic('1');
					mnArchivo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
					menuBar.add(mnArchivo);
					{
						separator = new JSeparator();
						separator.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mnArchivo.add(separator);
					}
					{
						mnCambiarIdioma = new JMenu(Messages.getString("Menu.113")); //$NON-NLS-1$
						mnCambiarIdioma.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mnCambiarIdioma.setToolTipText(Messages.getString("Menu.114")); //$NON-NLS-1$
						mnCambiarIdioma
								.setIcon(new ImageIcon(
										Menu.class
												.getResource("/recursos/select_language_32.png"))); //$NON-NLS-1$
						mnArchivo.add(mnCambiarIdioma);
						{
							mntmEspaol = new JRadioButtonMenuItem(Messages.getString("Menu.116")); //$NON-NLS-1$
							mntmEspaol.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							buttonGroup.add(mntmEspaol);
							mntmEspaol.addActionListener(new ActionListener() {
								public void actionPerformed(ActionEvent e) {
									Util.internacionalizarMensajes("castellano");
									Messages.setIdioma("castellano"); //$NON-NLS-1$
									Menu ventana = null;
									ventana = new Menu();
									ventana.VentanaPrincipal.setVisible(true);
									VentanaPrincipal.setVisible(false);
									ventana.mntmEspaol.setSelected(true);
									ventana.mntmIngls.setSelected(false);
									cargarCampos(ventana);
								}
							});
							mntmEspaol.setToolTipText(Messages.getString("Menu.117")); //$NON-NLS-1$
							mntmEspaol.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/banderaEsp.gif"))); //$NON-NLS-1$
							mnCambiarIdioma.add(mntmEspaol);
						}
						{
							mntmIngls = new JRadioButtonMenuItem(Messages.getString("Menu.119")); //$NON-NLS-1$
							mntmIngls.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							buttonGroup.add(mntmIngls);
							mntmIngls.addActionListener(new ActionListener() {
								public void actionPerformed(ActionEvent e) {
									Util.internacionalizarMensajes("Inglés");
									Messages.setIdioma("inglés"); //$NON-NLS-1$
									Menu ventana = null;
									ventana = new Menu();
									ventana.VentanaPrincipal.setVisible(true);
									VentanaPrincipal.setVisible(false);
									ventana.mntmEspaol.setSelected(false);
									ventana.mntmIngls.setSelected(true);
									cargarCampos(ventana);
								}
							});
							mntmIngls.setToolTipText(Messages.getString("Menu.120")); //$NON-NLS-1$
							mntmIngls.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/banderaIng.gif"))); //$NON-NLS-1$
							mnCambiarIdioma.add(mntmIngls);
						}
					}
					{
						separator_1 = new JSeparator();
						separator_1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mnArchivo.add(separator_1);
					}
					{
						mntmSalir = new JMenuItem(Messages.getString("Menu.122")); //$NON-NLS-1$
						mntmSalir.setMnemonic('E');
						mntmSalir.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mntmSalir.addActionListener(new SalirActionListener());
						{
							mntmAtrs = new JMenuItem(Messages.getString("Menu.123")); //$NON-NLS-1$
							mntmAtrs.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmAtrs.setEnabled(false);
							mntmAtrs.addActionListener(new AtrasActionListener());
							mntmAtrs.setIcon(new ImageIcon(CompeticionX.class
									.getResource("/recursos/Back.png"))); //$NON-NLS-1$
							mnArchivo.add(mntmAtrs);
						}
						mntmSalir.setIcon(new ImageIcon(Menu.class
								.getResource("/recursos/login_out_32.png"))); //$NON-NLS-1$
						mnArchivo.add(mntmSalir);
					}
				}
				{
					mnGestion = new JMenu(Messages.getString("Menu.126")); //$NON-NLS-1$
					mnGestion.setMnemonic('2');
					mnGestion.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
					menuBar.add(mnGestion);
					{
						mnParticipantes = new JMenu(Messages.getString("Menu.127")); //$NON-NLS-1$
						mnParticipantes.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mnParticipantes.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent e) {

								Menu.pnlParticipantes.setVisible(true);
								Menu.pnlBienvenida.setVisible(false);
								Menu.pnlCompeticiones.setVisible(false);
							}
						});
						mnParticipantes
								.setIcon(new ImageIcon(
										Menu.class
												.getResource("/recursos/Oil-icono-comunidad-32.png"))); //$NON-NLS-1$
						mnGestion.add(mnParticipantes);
						{
							mntmAadir = new JMenuItem(Messages.getString("Menu.129")); //$NON-NLS-1$
							mntmAadir.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmAadir
									.addActionListener(new AniadirActionListener());
							mntmAadir
									.setIcon(new ImageIcon(
											Menu.class
													.getResource("/recursos/anadir-usuario-icono-7225-32.png"))); //$NON-NLS-1$
							mnParticipantes.add(mntmAadir);
						}
						{
							mntmListaDeParticipantes = new JMenuItem(
									Messages.getString("Menu.131")); //$NON-NLS-1$
							mntmListaDeParticipantes.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmListaDeParticipantes
									.addActionListener(new AccederParticipantesActionListener());
							mntmListaDeParticipantes
									.setIcon(new ImageIcon(
											Menu.class
													.getResource("/recursos/nada32.png"))); //$NON-NLS-1$
							mnParticipantes.add(mntmListaDeParticipantes);
						}
					}
					{
						mnCompeticiones = new JMenu(Messages.getString("Menu.133")); //$NON-NLS-1$
						mnCompeticiones.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mnCompeticiones.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent e) {
								Menu.pnlCompeticiones.setVisible(true);
								Menu.pnlBienvenida.setVisible(false);
								Menu.pnlParticipantes.setVisible(false);
							}
						});
						mnCompeticiones
								.setIcon(new ImageIcon(
										Menu.class
												.getResource("/recursos/wooden_notepad_32.png"))); //$NON-NLS-1$
						mnGestion.add(mnCompeticiones);
						{
							mntmm = new JMenuItem("10.000m"); //$NON-NLS-1$
							mntmm.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmm.addActionListener(new SelectComp("10000m")); //$NON-NLS-1$
							mntmm.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/10000m32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmm);
						}
						{
							mntmCarreraPopular = new JMenuItem(
									Messages.getString("Menu.138")); //$NON-NLS-1$
							mntmCarreraPopular.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmCarreraPopular
									.addActionListener(new SelectComp(
											"CarreraPopular")); //$NON-NLS-1$
							mntmCarreraPopular
									.setIcon(new ImageIcon(
											Menu.class
													.getResource("/recursos/CarreraPopular32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmCarreraPopular);
						}
						{
							mntmCross = new JMenuItem(Messages.getString("Menu.141")); //$NON-NLS-1$
							mntmCross.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmCross
									.addActionListener(new SelectComp("Cross")); //$NON-NLS-1$
							mntmCross.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/cross32x32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmCross);
						}
						{
							mntmDuatln = new JMenuItem(Messages.getString("Menu.144")); //$NON-NLS-1$
							mntmDuatln.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmDuatln.addActionListener(new SelectComp(
									"Duatlon")); //$NON-NLS-1$
							mntmDuatln.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/Duatlon32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmDuatln);
						}
						{
							mntmMaratn = new JMenuItem(Messages.getString("Menu.147")); //$NON-NLS-1$
							mntmMaratn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmMaratn.addActionListener(new SelectComp(
									"Maraton")); //$NON-NLS-1$
							mntmMaratn.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/Maraton32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmMaratn);
						}
						{
							mntmMediaMaratn = new JMenuItem(Messages.getString("Menu.150")); //$NON-NLS-1$
							mntmMediaMaratn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmMediaMaratn.addActionListener(new SelectComp(
									"MediaMaratn")); //$NON-NLS-1$
							mntmMediaMaratn
									.setIcon(new ImageIcon(
											Menu.class
													.getResource("/recursos/MediaMaraton32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmMediaMaratn);
						}
						{
							mntmMontaa = new JMenuItem(Messages.getString("Menu.153")); //$NON-NLS-1$
							mntmMontaa.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmMontaa.addActionListener(new SelectComp(
									"Montana")); //$NON-NLS-1$
							mntmMontaa.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/Montaña32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmMontaa);
						}
						{
							mntmSanSilvestre = new JMenuItem(Messages.getString("Menu.156")); //$NON-NLS-1$
							mntmSanSilvestre.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmSanSilvestre.addActionListener(new SelectComp(
									"SSilvestre")); //$NON-NLS-1$
							mntmSanSilvestre
									.setIcon(new ImageIcon(
											Menu.class
													.getResource("/recursos/SanSilvestre32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmSanSilvestre);
						}
						{
							mntmTriatln = new JMenuItem(Messages.getString("Menu.159")); //$NON-NLS-1$
							mntmTriatln.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
							mntmTriatln.addActionListener(new SelectComp(
									"Triatlon")); //$NON-NLS-1$
							mntmTriatln.setIcon(new ImageIcon(Menu.class
									.getResource("/recursos/triatlon32.png"))); //$NON-NLS-1$
							mnCompeticiones.add(mntmTriatln);
						}
					}
				}
				{
					mnAyuda = new JMenu(Messages.getString("Menu.162")); //$NON-NLS-1$
					mnAyuda.setMnemonic('3');
					mnAyuda.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
					menuBar.add(mnAyuda);
					{
						mntmAyuda = new JMenuItem(Messages.getString("Menu.4")); //$NON-NLS-1$
						mntmAyuda.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mntmAyuda.addActionListener(new AyudaActionListener());
						mntmAyuda.setIcon(new ImageIcon(Menu.class
								.getResource(Messages.getString("Menu.164")))); //$NON-NLS-1$
						mnAyuda.add(mntmAyuda);
					}

					{
						mntmAcercaDe = new JMenuItem(Messages.getString("GestorCompeticiones.217")); //$NON-NLS-1$
						mntmAcercaDe.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
						mntmAcercaDe.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent e) {
								AcercaDe app = null;
								app = new AcercaDe(VentanaPrincipal);
								app.VentanaAcercaDe.setVisible(true);
								VentanaPrincipal.enable(false);
							}
						});
						mntmAcercaDe.setIcon(new ImageIcon(Menu.class
								.getResource(Messages.getString("Menu.166")))); //$NON-NLS-1$
						mnAyuda.add(mntmAcercaDe);
					}
				}
			}
			{
				lblFondo = new JLabel(""); //$NON-NLS-1$
				lblFondo.setIcon(new ImageIcon(Menu.class
						.getResource("/recursos/FONDO.jpg"))); //$NON-NLS-1$
				lblFondo.setBounds(0, -19, 1186, 921);
				pnlGeneral.add(lblFondo);
			}
		}
		Util.recuperarIdioma(mntmEspaol, mntmIngls);

	}

	private class AyudaActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			JOptionPane
					.showMessageDialog(
							VentanaPrincipal,
							Messages.getString("Menu.169") //$NON-NLS-1$
									+ Messages.getString("Menu.170") //$NON-NLS-1$
									+ Messages.getString("Menu.171") //$NON-NLS-1$
									+ Messages.getString("Menu.172"), //$NON-NLS-1$
							Messages.getString("Menu.173"), JOptionPane.INFORMATION_MESSAGE); //$NON-NLS-1$
		}
	}

	private class AccederParticipantesActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			mntmAtrs.setEnabled(true);
			pnlParticipantes.enable(true);
			pnlParticipantes.setVisible(true);
			pnlBienvenida.enable(false);
			pnlBienvenida.setVisible(false);
			pnlCompeticiones.enable(false);
			pnlCompeticiones.setVisible(false);
			btnSalir.setVisible(false);
		}
	}

	private class AniadirActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			AddParticipante ap = null;

			ap = new AddParticipante(VentanaPrincipal);

			ap.VentanaAnadirParticipante.setVisible(true);
			VentanaPrincipal.enable(false);

		}
	}

	private class ConsultarActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if (lstParticipantes.isSelectionEmpty() == false) {
				
			
			InformacionParticipante i = null;

			i = new InformacionParticipante(VentanaPrincipal);

			i.VentanaInfoParticipante.setVisible(true);
			i.VentanaInfoParticipante.setTitle(lstParticipantes
					.getSelectedValue().toString());
			VentanaPrincipal.enable(false);
			} else {
				JOptionPane.showMessageDialog(VentanaPrincipal, Messages.getString("Menu.174")); //$NON-NLS-1$
		}
		}
	}

	public class SelectComp implements ActionListener {
		String boton;

		public SelectComp(String seleccion) {
			boton = seleccion;
		}

		public void actionPerformed(ActionEvent e) {
			GestorCompeticiones gc = new GestorCompeticiones(VentanaPrincipal);
			gc.VentanaCompeticiones.setVisible(true);
			VentanaPrincipal.setVisible(false);
			switch (boton) {
			case "10000m": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(0);
				break;
			case "CarreraPopular": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(1);
				break;
			case "Cross": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(2);
				break;
			case "Duatlon": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(3);
				break;
			case "Maraton": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(4);
				break;
			case "MediaMaraton": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(5);
				break;
			case "Montana": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(6);
				break;
			case "SSilvestre": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(7);
				break;
			case "Triatlon": //$NON-NLS-1$
				gc.tabbedPane.setSelectedIndex(8);
				break;

			}
		}
	}

	private class AtrasActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			mntmAtrs.setEnabled(false);
			pnlCompeticiones.setVisible(false);
			pnlCompeticiones.enable(false);
			pnlParticipantes.setVisible(false);
			pnlParticipantes.enable(false);
			pnlBienvenida.setVisible(true);
			pnlBienvenida.enable(true);
			btnSalir.setVisible(true);
		}
	}

	private class ModificarActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			if(lstParticipantes.isSelectionEmpty()==false){
				AddParticipante ap = null;
				
				ap = new AddParticipante(VentanaPrincipal);
				
				ap.VentanaAnadirParticipante.setVisible(true);
				ap.VentanaAnadirParticipante.setTitle(Messages.getString("Menu.184")); //$NON-NLS-1$
				ap.modificar(lstParticipantes.getSelectedValue().toString());
			} else {
				JOptionPane.showMessageDialog(VentanaPrincipal, Messages.getString("Menu.185")); //$NON-NLS-1$
		}
		}
	}

	private class EliminarActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if(lstParticipantes.isSelectionEmpty()==false){
			if (JOptionPane.showOptionDialog(VentanaPrincipal,
					Messages.getString("Menu.186") //$NON-NLS-1$
							+ lstParticipantes.getSelectedValue().toString()
							+ "?", Messages.getString("Menu.188"), //$NON-NLS-1$ //$NON-NLS-2$
					JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
					null, null, null) == 0) {
				JOptionPane.showMessageDialog(VentanaPrincipal,
						Messages.getString("Menu.189"), //$NON-NLS-1$
						Messages.getString("Menu.190"), //$NON-NLS-1$
						JOptionPane.INFORMATION_MESSAGE);
			}
			} else {
				JOptionPane.showMessageDialog(VentanaPrincipal, Messages.getString("Menu.191")); //$NON-NLS-1$
		}
		}
			
	}

	private class SalirActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if (JOptionPane
					.showConfirmDialog(
							VentanaPrincipal,
							Messages.getString("Menu.192"), //$NON-NLS-1$
							Messages.getString("Menu.193"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.YES_OPTION) { //$NON-NLS-1$
				System.exit(0);
			}
		}
	}
	
	private void cargarCampos(Menu ventana){
		ventana.lblHora.setText(lblHora.getText());
		ventana.lblUserIdent.setText(lblUserIdent.getText());
		ventana.lblNombre.setText(lblNombre.getText());
	}
}
